package com.qk.mapper;

import com.qk.dto.CourseDto;
import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {
    List<Course> selectList(CourseDto courseDto);

    @Delete("delete from course where id =#{id}" )
    void deleCourseById(Integer id);


   @Insert( "INSERT INTO course(name, subject,price, target, description,create_time, update_time) " +
            "VALUES(#{name}, #{subject}, #{price},#{target}, #{description},#{createTime}, #{updateTime})")
    void addCourse(Course course);

   @Select("select id, subject, name, price, target, description, create_time, update_time from course where id = #{id}")
    Course selectById(Integer id);

    void updateCourse(Course course);

    @Select("select id, subject, name, price, target, description, create_time, update_time from course")
    List<Course> getAll();

    List<Course> selectCourseBySubject(String subject);
}
